home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / shots / BugBFireA.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.0 KB  |  86 lines

  1. class classes.shots.BugBFireA
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var dir;
  7.    var clip;
  8.    var axis;
  9.    var xMov = 0;
  10.    var yMov = 0;
  11.    var Name = "bugBFireA";
  12.    var power = 20;
  13.    var yank = false;
  14.    function BugBFireA(px, py, pDir, pid)
  15.    {
  16.       this.x = px;
  17.       this.y = py;
  18.       this.id = pid;
  19.       this.dir = pDir;
  20.       _root.d = _root.d + 1;
  21.       this.clip = _root.attachMovie("bugBFireA","bugBFireA" + this.id + "Clip",_root.d);
  22.       this.clip._x = this.x;
  23.       this.clip._y = this.y;
  24.       this.clip.id = this.id;
  25.       if(this.dir == "U")
  26.       {
  27.          this.axis = "y";
  28.          this.yMov = -15;
  29.          this.xMov = 0;
  30.          this.y += 15;
  31.       }
  32.       else if(this.dir == "D")
  33.       {
  34.          this.axis = "y";
  35.          this.yMov = 15;
  36.          this.xMov = 0;
  37.          this.y -= 15;
  38.       }
  39.       else if(this.dir == "R")
  40.       {
  41.          this.axis = "x";
  42.          this.yMov = 0;
  43.          this.xMov = 15;
  44.          this.x -= 15;
  45.       }
  46.       else
  47.       {
  48.          this.axis = "x";
  49.          this.yMov = 0;
  50.          this.xMov = -15;
  51.          this.x += 15;
  52.       }
  53.       this.xMov *= _root.dif.speed;
  54.       this.yMov *= _root.dif.speed;
  55.       this.clip.gotoAndStop(this.dir);
  56.       this.xMov *= _root.randRange2(0.9,1.1);
  57.       this.yMov *= _root.randRange2(0.9,1.1);
  58.    }
  59.    function hit()
  60.    {
  61.       this.yank = true;
  62.    }
  63.    function main()
  64.    {
  65.       this[this.axis + "Mov"] *= 1.02;
  66.       if(this.clip.hitTest(_root[_root.char + "Clip"]))
  67.       {
  68.          _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
  69.          this.yank = true;
  70.       }
  71.       if(this.x > 1050 || this.x < -50 || this.y > 650 || this.y < -50)
  72.       {
  73.          this.yank = true;
  74.       }
  75.       this.x += this.xMov;
  76.       this.y += this.yMov;
  77.       if(this.yank)
  78.       {
  79.          _root.removeEnemyShot("bugBFireA" + this.id);
  80.          this.yank = false;
  81.       }
  82.       this.clip._x = this.x;
  83.       this.clip._y = this.y;
  84.    }
  85. }
  86.